<template>
  <fieldset>
    <legend>列表页</legend>
    <ul>
      <li v-for="item in list" :key="item._id">        
        <!-- <router-link :to="{ path: `/detail/${item.productId}` }">
          {{ item.productName }}
        </router-link> -->
        <button @click="jump1(item)">点击跳转</button>
        {{ item.productName  }}
        {{ item.productId  }}
      </li>
    </ul>
  </fieldset>
</template>

<script>
export default {
  data() {
    return {
      list: [],
    };
  },
  mounted() {
    fetch("http://chst.vip:1234/api/getmoneyctrl")
      .then((body) => body.json())
      .then((res) => {
        console.log(res);
        this.list = res.result;
      });
  },
  methods:{
    jump1(item){
      // this.$router.push({
      //   path: `/detail/${22}`
        
      // })
      
      // this.$router.push({path:"/detail/21"})
      this.$router.push({path: `/detail/${item.productId}` } )
     
    }
  }
};
</script>
